﻿using System;
using System.Collections.Concurrent;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Abp.AspNetCore.Mvc.Authorization;
using Abp.AutoMapper;
using KelonProud.Administration.Dtos;
using KelonProud.Administration.Managers.Application;
using KelonProud.Administration.Managers.Authorization;
using KelonProud.Administration.Managers.MultiTenancy;
using KelonProud.Controllers;

using Abp.Domain.Repositories;
using KelonProud.Administration.Domain.Organizations;

using Microsoft.AspNetCore.Hosting;
using KelonProud.TableManagement.Dtos.DataBase;

namespace KelonProud.Web.Controllers
{
    [AbpMvcAuthorize]
    public class HomeController : KelonProudControllerBase
    {
        private readonly RoleManager _roleManager;
        private readonly EditionManager _editionManager;
        private readonly TenantManager _tenantManager;
        private readonly IHostingEnvironment _environment;
        private readonly IRepository<KelonProudOrganizationUnit, long> _organizationUnitRepository;
        private readonly AttachmentManager _attachmentManager;

        public HomeController(RoleManager roleManager, EditionManager editionManager, TenantManager tenantManager,
            IRepository<KelonProudOrganizationUnit, long> organizationUnitRepository, IHostingEnvironment environment, 
            AttachmentManager attachmentManager)
        {
            _roleManager = roleManager;
            _editionManager = editionManager;
            _tenantManager = tenantManager;
            _organizationUnitRepository = organizationUnitRepository;
            _environment = environment;
            _attachmentManager = attachmentManager;
        }

        public ActionResult Index()
        {

            return View();
        }

        public ActionResult UserPanel()
        {
            return View();
        }


        public ActionResult Test()
        {
            //var require = new RequireDto();
            //var type = _requireManager.GetRequire(id);

            //if (type != null)
            //{
            //    //获得需求的文件集合
            //    require = type.MapTo<RequireDto>();
            //    require.AttackmentList = _attachmentManager.GetFileList(require.ImgUrls).MapTo<List<AttachmentDto>>();
            //}

            return View();
        }

        public ActionResult Test2()
        {
            //var list = _organizationUnitRepository.GetAll();
            throw new Exception("1`2");
            return View();
        }

        public ActionResult ZLTest()
        {
            return View(new DataBaseInput());
        }
    }
}
